package cn.wolfcode.domain;

import cn.wolfcode.meiju.NoticeStatusEnum;
import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Getter
@Setter
public class Notice {
    /** 主键id，自增*/
    private Long id;

    /** 标题*/
    private String title;

    /** 创建公告人，关联员工（通过员工id）*/
    private Employee employee;

    /** 创建时间*/
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date creat_time;

    /** 公告等级*/
    private Integer level;

    /** 会员读取状态*/
    private Boolean read_status;

    /** 发布状态*/
    private Boolean publish_status ;

    /** 公告内容*/
    private String context;

    private ReadStatus readStatus;

    public String getLevelName(){
        return NoticeStatusEnum.findName(level);
    }
    public Integer getValue(){
        return level;
    }


    public String toJson(){
        return JSON.toJSONString(this);
    }
}